<!DOCTYPE html>
<html>
    <head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>审核管理- 审核相册详情</title>
	<meta name="keywords" content="">
	<meta name="description" content="">
	<link rel="shortcut icon" href="../favicon.ico">
	<link href="__PUBLIC__/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
	<link href="__PUBLIC__/css/font-awesome.css?v=4.4.0" rel="stylesheet">
	<link href="__PUBLIC__/css/plugins/iCheck/custom.css" rel="stylesheet">
	<link href="__PUBLIC__/css/animate.css" rel="stylesheet">
	<link href="__PUBLIC__/css/style.css?v=4.1.0" rel="stylesheet">
	<link rel="stylesheet" href="__PUBLIC__/css/liandong.css"/>
	<link href="__PUBLIC__/Widget/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
	<script src="__PUBLIC__/js/plugins/layer/laydate/laydate.js"></script>
	<style>
	    .img{ width: auto !important; max-width: 128px; max-height: 128px; }
	    .img2{ width: auto !important; max-width: 64px; max-height: 64px; }
	    .img_default{ width: auto !important; max-width: 128px; max-height: 128px; }
	    .control-label.control-label-l{ text-align: left; }
	</style>
    </head>
    <body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
	    <div class="row">
		<div class="col-sm-12">
		    <div class="ibox float-e-margins">
			<div class="ibox-title">
			    <h5>审核管理- <small>审核相册详情</small>
			    </h5>
			</div>
			<div class="ibox-content">
			    <form method="post" class="form-horizontal" onsubmit="return false">
				<div class="form-group">
				    <label class="col-sm-2 control-label">编号</label>
				    <div class="col-sm-10 control-label" style="text-align: left;">
					<{$data.id}>
				    </div>
				</div>
				<div class="form-group">
				    <label class="col-sm-2 control-label">相册照片</label>
				    <div class="col-sm-10">
					<div class="btn-file">
					    <button class="btn btn-primary">上传图片</button>
					    <input id="logoimg" type="file" name="logoimg">
					    <input id="logosrc" type="hidden" name="logosrc" value="<{$data.img}>">
					</div>
					<div class="product_img">
					    <if condition="$data.img neq null && $data.img neq ''">
						<img id="inputfile-img" alt='未找到图片' src="<{$data.img}>" class="img">
						<else />
						<img id="inputfile-img" alt='未找到图片' src="__PUBLIC__/img/webuploader.png" class="img_default">
					    </if>
					</div>
				    </div>
				</div>
				<if condition="$type eq 2">
				    <div class="form-group">
					<label class="col-sm-2 control-label">状态</label>
					<div class="col-sm-10 control-label" style="text-align: left;">
					    <{$data.state_text}>
					</div>
				    </div>
				</if>
				<if condition="$type eq 2">
				    <div class="form-group">
					<label class="col-sm-2 control-label">审核时间</label>
					<div class="col-sm-10 control-label" style="text-align: left;">
					    <{$data.ptime}>
					</div>
				    </div>
				    <else/>
				</if>
				<div class="form-group">
				    <label class="col-sm-2 control-label">上传时间</label>
				    <div class="col-sm-10 control-label" style="text-align: left;">
					<{$data.ctime}>
				    </div>
				</div>
				<div class="form-group">
				    <label class="col-sm-2 control-label">用户信息</label>
				    <div class="col-sm-10">
					<div style="padding: 15px 0; border:1px solid #cfdadd;">
					    <div class="form-group">
						<label class="col-sm-2 control-label">头像</label>
						<div class="col-sm-9 control-label control-label-l">
						    <if condition="$data.user_logo neq null && $data.user_logo neq ''"><img alt="未找到图片" class="img2" src="<{$data.user_logo}>" /></if>
						</div>
					    </div>
					    <div class="form-group">
						<label class="col-sm-2 control-label"><{$app_name2}>号</label>
						<div class="col-sm-9 control-label" style="text-align: left;">
						    <{$data.user_id}>
						</div>
					    </div>
					    <div class="form-group">
						<label class="col-sm-2 control-label">用户昵称</label>
						<div class="col-sm-9 control-label" style="text-align: left;">
						    <{$data.user_name}>
						</div>
					    </div>
					    <div class="form-group">
						<label class="col-sm-2 control-label">性别</label>
						<div class="col-sm-9 control-label" style="text-align: left;">
						    <{$data.user_sex_text}>
						</div>
					    </div>
					    <div class="form-group">
						<label class="col-sm-2 control-label">手机号码</label>
						<div class="col-sm-9 control-label" style="text-align: left;">
						    <{$data.user_phone}>
						</div>
					    </div>
					</div>
				    </div>
				</div>
				<div class="hr-line-dashed"></div>
				<div class="form-group">
				    <div class="col-sm-4 col-sm-offset-2">
					<button class="btn btn-primary" type="button" onclick="img_add_submit()">修改相册</button>&nbsp;&nbsp;&nbsp;
					<if condition="$data.state eq 3">
					    <else/>
					    <button class="btn btn-info" type="button" onclick="check('<{$id}>', '1')">通过</button>&nbsp;&nbsp;&nbsp;
					</if>
					<if condition="$data.state eq 4">
					    <else/>
					    <button class="btn btn-danger" type="button" onclick="check('<{$id}>', '2')">驳回</button>
					</if>
				    </div>
				</div>
			    </form>
			</div>
		    </div>
		</div>
	    </div>
	</div>
	<!--  全局js -->
	<script src="__PUBLIC__/js/jquery.min.js?v=2.1.4"></script>
	<script src="__PUBLIC__/js/bootstrap.min.js?v=3.3.6"></script>
	<!-- 自定义js -->
	<script src="__PUBLIC__/js/content.js?v=1.0.0"></script>
	<script src="__PUBLIC__/js/plugins/layer/layer.min.js"></script>
	<script src="__PUBLIC__/js/liandong.js"></script> 
	<script src="__PUBLIC__/js/ajaxfileupload.js"></script>
	<script src="__PUBLIC__/Widget/webuploader/0.1.5/webuploader.min.js"></script>
	<!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
	<script>
						var id = "<{$id}>";
						var phone = "<{$phone}>";
						var typevalue = "<{$type}>";
						var imguploadsubmit = "<{:U('imgupload','','')}>";
						var userimgsidentityaddsubmit = "<{:U('userimgsidentityaddsubmit','','')}>";
						var userimgsidentitylist = "<{:U('userimgsidentitylist','','')}>";
						var userimgsidentitysubmit = "<{:U('userimgsidentitysubmit','','')}>";
						var $logoimg = $("#logoimg");
						var $logosrc = $("#logosrc");
						$logoimg.change("propertychange", function () {
						    ajaxFileUpload();
						});
						function img_add_submit() {
						    var $logosrc = $("#logosrc");
						    var logosrc = $logosrc.val();
						    layer.confirm('确定修改该相册吗？', function (index) {
							layer.close(index);
							//加载loading层
							var loading = layer.load(1, {
							    shade: [0.1, '#fff'] //0.1透明度的白色背景
							});
							$.post(userimgsidentityaddsubmit, {'id': id, 'img': logosrc},
								function (data) {
								    if (data.ret == '1001') {
									layer.close(loading);
									layer.msg(data.code, {icon: 6, time: 1000});
									setTimeout(function () {
									    window.location.href = userimgsidentitylist + '/type/' + typevalue;
									}, 1000);
								    } else {
									layer.close(loading);
									layer.msg(data.code, {icon: 5, time: 1000});
								    }
								}, 'json');
						    });
						}
						function check(id, type) {
						    layer.confirm('确定' + (type == '1' ? '通过' : '驳回') + '该相册吗？', function (index) {
							layer.close(index);
							$.post(userimgsidentitysubmit, {'id': id, 'type': type},
								function (data) {
								    if (data.ret == '1001') {
									layer.msg(data.code, {icon: 6, time: 1000});
									setTimeout(function () {
									    window.location.reload();
									}, 1000);
								    } else {
									layer.msg(data.code, {icon: 5, time: 1500});
								    }
								}, 'json');
						    });
						}
						function ajaxFileUpload() {
						    $.ajaxFileUpload({
							url: imguploadsubmit, //你处理上传文件的服务端
							type: 'post',
							data: {phone: phone, type: 'photos'},
							secureuri: false, //与页面处理代码中file相对应的ID值
							fileElementId: 'logoimg',
							dataType: 'JSON', //返回数据类型:TEXT，XML，JSON，HTML，SCRIPT，JSONP五种
							success: function (data, status) {
							    var $inputfileimg = $("#inputfile-img");
							    var $logosrc = $("#logosrc");
							    var $logoimg = $("#logoimg");
							    data = $(data).text();
							    data = data.substring(0, data.indexOf('}') + 1);
							    data = eval("(" + data + ")");
							    if (data.ret == '1001') {
								layer.msg(data.code, {icon: 6, time: 1000});
								$inputfileimg.removeClass('img_default').addClass('img').attr('src', data.data);
								$logosrc.val(data.data);
							    } else {
								layer.msg(data.code, {icon: 5, time: 1500});
							    }
							    $logoimg.change("propertychange", function () {//再次绑定
								ajaxFileUpload();
							    });
							},
							error: function (data, status, e) {
							    alert(status);
							}
						    });
						    return false;
						}

	</script>
    </body>
</html>
